package com.tmptSource.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by wxy on 2017/9/6.
 */
public enum AdvMaterial {
    Glass("1", "玻璃", 0L),
    StainlessSteel("2", "不锈钢", 0L),
    Cloth("3", "布", 0L),
    Al("4", "铝", 0L),
    Iron("5", "铁", 0L),
    AlPlastic("6", "铝塑", 0L),
    LED("7", "电子显示屏", 0L),
    Canvas("8", "帆布", 0L),
    Steel("9", "钢", 0L),
    Wood("10", "木", 0L),
    Plastic("11", "塑", 0L),
    SteelStructure("12", "钢结构", 0L),
    AngleIron("13", "角铁", 0L),
    IronSheet("14", "铁皮", 0L),
    DensityBoard("15", "密度板", 0L),
    FoamBoard("16", "泡沫", 0L),
    InkJetCloth("17", "喷绘布", 0L),
    WallBoard("18", "墙板", 0L),
    Stone("19", "石", 0L),
    Gypsum("20", "石膏", 0L),
    PVC("21", "PVC", 0L),
    Acrylic("22", "亚克力", 0L),
    Paper("23", "纸", 0L),
    Brick("24", "砖", 0L),
    AlSheet("25", "铝皮", 0L),
    PlasticBoard("26", "塑板", 0L),
    WoodBoard("27", "木板", 0L);

    private final String keyName;
    private final String valueName;
    private Long optionId;//选择指定的optionid后，隐藏哪些列

    AdvMaterial(String keyName, String valueName, Long optionId ) {
        this.keyName = keyName;
        this.valueName = valueName;
        this.optionId = optionId;
    }

    public static String explain( String keyName ) {
        return explain( keyName, null ) ;
    }

    public static String explain( String keyName, String unexpectedValue ) {
        for (AdvMaterial enum1 : AdvMaterial.values()) {
            if (enum1.keyName.equals(keyName)) {
                return enum1.getValueName();
            }
        }
        return unexpectedValue;
    }

    public static List<Map<String,String>> toList () {
        List <Map<String,String>> list = new ArrayList();
        for (AdvMaterial enum1 : AdvMaterial.values()) {
            Map<String,String> map = new HashMap();
            map.put("keyName", enum1.getKeyName());
            map.put("valueName", enum1.getValueName());
            map.put("optionId", String.valueOf(enum1.getOptionId()));
            list.add(map);
        }
        return list;
    }

    public String getKeyName() {
        return keyName;
    }

    public String getValueName() {
        return valueName;
    }
    public Long getOptionId() {
        return optionId;
    }
}
